﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../back-common.jsp"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp"%>
        <script src="${contextPath}/resources/common/js/jquery.validate.js" type="text/javascript"></script>
        <link rel="stylesheet" type="text/css" media="screen" href="${contextPath}/resources/common/css/errorform.css" />
		<style type="text/css">
			.center_letter{
				text-align: center;
			}
			
		</style>
      <form:form   action="${contextPath}/admin/member/role/save" id="form1" method="post">      
        <table class="${tableclass}" style="width: 100%">
	    <thead>
	    	<tr><th><strong class="am-text-primary am-text-lg">权限管理</strong> /  
	    			<c:choose>
	                	<c:when test="${not empty bean}">修改角色</c:when>
	                	<c:otherwise>创建角色</c:otherwise>
	                </c:choose>
	    	</th></tr>
	    </thead>
	    </table>
       <input type="hidden" name="id" value="${bean.id }">
          <div align="center">
            <table  align="center" class="${tableclass}" id="col1">
     	 <tr>
        <td class="center_letter" width="230px;">
          名称 <font color="ff0000">*</font>
       </td>
        <td>
           <input type="text" name="name" id="name" value="${bean.name}"/>
        </td>
      </tr>
      <tr>
        <td class="center_letter">
          角色名称 <font color="ff0000">*</font>
       </td>
        <td>
           <input type="text" name="roleType" id="roleType" value="${bean.roleType}" />
        </td>
      </tr>
      <tr>
        <td class="center_letter">状态</td>
        <td>
          <label>
            <input type="radio" name="enabled" value="1"   checked="checked"  /> 有效</label> &nbsp; &nbsp;  
         <label>
            <input type="radio" name="enabled" value="0"
			        <c:if test="${bean.enabled eq 0}">
			            checked="checked"
			        </c:if>  
			         />
			            无效</label>
        </td>
      </tr>
       <tr>
        <td class="center_letter">所属应用</td>
        <td>
              <select id="appNo" name="appNo">
				  <ls:optionGroup type="select" required="true" cache="true"
	                beanName="APP_NO" selectedValue="${bean.appNo}"/>
	            </select>
        </td>
      </tr>
       <tr>
        <td class="center_letter"> 角色类型</td>
        <td>
              <select id="category" name="category">
				  <ls:optionGroup type="select" required="true" cache="true"
	                beanName="ROLE_CATEGORY" selectedValue="${bean.category}"/>
	            </select>
	            (系统角色只有管理员可以操作)
        </td>
      </tr>
      <tr>
        <td  class="center_letter"> 备注 </td>
        <td>
           <input name="note" type="text" value="${bean.note}">
        </td>
      </tr>
       <tr>
           <td colspan="2"   class="center_letter">
    				<input class="${btnclass}" type="submit" value="提交" />
                   	<input class="${btnclass}" type="reset" value="重置" />
                   	<input class="${btnclass}" type="button" value="返回"
                       onclick="window.location='${contextPath}/admin/member/role/query'" />
               </div>
           </td>
       </tr>
   </table>
  </div>
 </form:form>
<script language="javascript">
    $.validator.setDefaults({
    });

    $(document).ready(function() {
    jQuery("#form1").validate({
        rules: {
            name: {
                required: true
            },
            roleType: {
		        required: true
		    }
        },
        messages: {
       	 name: {
             required: '<fmt:message key="name.required"/>'
         },
         roleType: {
             required: '<fmt:message key="roletype.required"/>'
         }
        }
    });
 		   highlightTableRows("col1");
         //斑马条纹
     	 $("#col1 tr:nth-child(even)").addClass("even");
});
</script>    
